/****************************************
 *	ToolTip2
 *	上午11:34:16
 *	by Jane
 ****************************************/
package com.swfgui.controls
{
	import com.swfgui.core.IToolTip;
	import com.swfgui.core.UIComponent;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;

	public class ToolTip2 extends UIComponent implements IToolTip
	{
		private var viewText :TextField;
		private var skin :MovieClip;
		
		public function ToolTip2(viewSource:Object=null)
		{
			super(viewSource);
		}
		
		override public function get className():String
		{
			return "ToolTip2";
		}
		
		override protected function initialize():void
		{
			viewText = (view as DisplayObjectContainer).getChildByName('viewText') as TextField;
			skin = (view as DisplayObjectContainer).getChildByName('skin') as MovieClip;			
			super.initialize();
			viewText.multiline = true;
			viewText.wordWrap = true;
			viewText.autoSize = TextFieldAutoSize.LEFT;		
		}	
		
		override public function set width(value:Number):void
		{	
			super.width = value;
			viewText.width = width-20;			
		}
		
		public function get text():String
		{
			return viewText.text;
		}
		
		public function set text(value:String):void
		{
			viewText.text = value;
			super.height = viewText.height+20;
		}
		
		public function set htmlText(value:String):void
		{
			viewText.htmlText = value;
			super.height = viewText.height+20;
		}
		
		
	}
}